<template>
    <div>
        <!-- <basic-infor-mation @minProfitRateChange="minProfitRateChange" :channelId="channelId" :merchantInfo="merchantInfo" :userinfo="userinfo" @userTypeChange="userTypeChange" ref="basicInfo"/> -->
        <!-- <personal-inlet  ref="personal" v-show="userType == '1'" :minProfitRate="minProfitRate" :dLimitList="dLimitList" :mccList1="mccList1" :regionList="regionList" :secondaryList="secondaryList"/> -->
        <enterprise-inlet @operateFormChange="operateFormChange" ref="enterprise" v-show="userType == '2'" :minProfitRate="minProfitRate" :dLimitList="dLimitList" :regionList="regionList" :mccList1="mccList1" :secondaryList="secondaryList"/>
        <img-qualifi-cation @fileListChange="fileListChange" ref="imgQualifi"/>
        <el-card >
          <div class="submit">
            <el-button icon="el-icon-check" :loading="btnLoading" class="btn" type="primary" @click="submit">提交</el-button>
          </div>
        </el-card>
    </div>
</template>
<script>
import basicInformation from "./components/basicInformation.vue"
import personalInlet from './components/personalInlet.vue'
import enterpriseInlet from './components/enterpriseInlet.vue'
import settlementConfig from "./components/settlementConfig.vue"
import cashOutConfig from "./components/cashOutConfig.vue"
import imgQualification from './components/imgQualification.vue'
import { getAreaAll , huijuBasicdataIndv} from '@/api/fetchApi.js'
import md5 from "js-md5";
import { dLimitList } from '../../../../utils/bank.js'
import { singleChannelModify , merchantGet , getTopMccByType , singleChannelSave , arealist  , parentlist } from '@/api/api'
export default{
    components:{
        'personal-inlet':personalInlet,
        'basic-infor-mation':basicInformation,
        'enterprise-inlet':enterpriseInlet,
        'settlement-config':settlementConfig,
        'cashOut-config':cashOutConfig,
        'img-qualifi-cation':imgQualification
    },
   data(){
     return{
        protocolChecked:true,
        userType:'2',
        regionList:[], //省市区
        secondaryList:[], //省市
        mccList1:[],
        dLimitList:dLimitList,
        userinfo:{},
        merchantId:'',
        cashConfig:[],
        qry_cash_config_list:[],
        merchantInfo:{},
        btnLoading:false,
        channelId:'',
        minProfitRate:0,
        openForm:{},
        imgForm:{},
        merchantId:''
     }
   },
   mounted(){
        const userInfo = JSON.parse(sessionStorage.getItem('userInfo'))
          this.merchantId = userInfo.mid
          console.log(this.merchantId)
   },
   methods:{
    async initMerchantInfo(){
     
    },
    async submit(){
      //  const data = Object.assign(this.openForm)
      this.openForm.merchantId = this.merchantId
      const data = Object.assign({merchantId:this.merchantId},this.openForm,this.imgForm)
       const res = await huijuBasicdataIndv(data)
    },
    operateFormChange(v){
      this.openForm = v
    },
    fileListChange(v){
      this.imgForm = v
    },
    // cashOutConfigChange(v){
    //   this.cashConfig = []
    //     if(v.T1Form.cash_type){
    //       this.cashConfig.push(v.T1Form)
    //     }
    //      if(v.DMForm.cash_type){
    //       this.cashConfig.push(v.DMForm)
    //     }
    //   // this.cashConfig = v
    // },
    userTypeChange(v){
        this.userType = v
    }
   }
}
</script>
<style> 
.clearfix{
  display:flex;
  align-items:center;
}

.submit{
  display:flex;
  justify-content:center;
}
</style>